package com.czp.log.service.impl;

import org.apache.ibatis.session.RowBounds;

import com.czp.framework.model.DataStoreTemplate;
import com.czp.log.mapper.ILogMapper;
import com.czp.log.model.Log;
import com.czp.log.service.ILogService;
import com.google.gson.Gson;

/**
 * 【环 境】：J2SE 1.7
 * @author   柴志鹏	CHAIZP@GMAIL.COM
 * @version  version 1.0
 * @since    2014-9-10
 */
public class LogServiceImpl implements ILogService {
	private ILogMapper logMapper;
	private Gson gson = new Gson();

	public String queryLogInfoList(Log log) throws Exception {
		RowBounds rb = new RowBounds(log.getStart(), log.getLimit());
		DataStoreTemplate dst = new DataStoreTemplate();
		dst.setList(logMapper.queryLogInfoList(log, rb));
		dst.setTotal(logMapper.queryLogInfoCount(log));
		return gson.toJson(dst);
	}
	
	/**
	 * 获取 logMapper
	 * @return 返回 logMapper
	 */
	public ILogMapper getLogMapper() {
		return logMapper;
	}

	/**
	 * 设置 logMapper
	 * @param 对logMapper进行赋值
	 */
	public void setLogMapper(ILogMapper logMapper) {
		this.logMapper = logMapper;
	}
	
}
